/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package course.services;

import course.entities.Record;
import course.entities.UserActivity;
import java.io.Serializable;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean(name = "viewerBean")
@SessionScoped
public class ViewerBean implements Serializable {

    public ViewerBean() {
    }

    private UserActivity activity;
    
    private long imageId;

    public long getImageId() {
        return imageId;
    }

    public void setImageId(long imageId) {
        this.imageId = imageId;
    }

    public String redirect(UserActivity activity) {
        if (activity == null) {
            return "";
        } else {
            this.activity = activity;
        }
        return "/pages/viewer?faces-redirect=true";
    }

    public String getSourceCode() {
        return activity.getSourceCode();
    }

    public String getName() {
        return activity.getClassName();
    }

    public List<Record> getRecordList() {
        return activity.getRecordList();
    }
}
